package com.example.demo.service;

import com.example.demo.domain.Admin;
import com.example.demo.mapper.AdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService{
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public int addAdmin(Admin admin) {
        return adminMapper.InsertAdmin(admin);
    }

    @Override
    public int deleteAdmin(Integer id) {
        return adminMapper.DeleteAdmin(id);
    }

    @Override
    public Admin selectAdmin(Integer id) {
        return adminMapper.SelectAdmin(id);
    }

    @Override
    public int updateAdmin(Admin admin) {
        return adminMapper.UpdateAdmin(admin);
    }

    @Override
    public List<Admin> findAll() {
        return adminMapper.SelectAll();
    }

    public Admin verify(String user_name,String password){
        return adminMapper.VerifyLogin(user_name,password);
    }
}
